package com.qzy.reggie.service.impl;

import com.qzy.reggie.mapper.CategoryM;
import com.qzy.reggie.pojo.Category;
import com.qzy.reggie.service.CategoryS;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

public class CategorySL implements CategoryS {

    @Autowired
    private CategoryM categoryMapper;

    @Override
    public List<Category> queryCategoryList(Category category) {
        return categoryMapper.selectList(category);
    }


    @Override
    public Category getCategoryById(Long id) {
        if(id == null){
            return null;
        }
        Category category = new Category();
        category.setId(id);
        return categoryMapper.selectOne(category);
    }




    @Override
    public Integer save(Category category) {

        return categoryMapper.insert(category);
    }



    @Override
    public Integer update(Category category) {
        return categoryMapper.update(category);
    }

    @Override
    public Integer deleteCategory(Long id) {
        return categoryMapper.delete(id);
    }


}
